﻿@model IEnumerable<BusinessLayer.Employee>

@{
    ViewBag.Title = "Index";
}

<div style="font-family: Arial">
    <h2>Index</h2>

    <p>
        @Html.ActionLink("Create New", "Create")
    </p>
    <table border="1">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Gender)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.City)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.DateOfBirth)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.DepartmentId)
            </th>
            <th>Action
            </th>
        </tr>

        @foreach (var item in Model)
        {
            using (Html.BeginForm("Delete", "BusinessEmployee", new { id = item.EmployeeId }))
            {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Gender)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.City)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DateOfBirth)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DepartmentId)
                </td>
                <td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.EmployeeId }) |
                    <input type="submit" value="Delete" onclick="return confirm('Are you sure you want to delete employee with Id = @item.EmployeeId');"/>
                </td>
            </tr>
            }
        }

    </table>
</div>
